package com.itheima.thread.atomic.demo04;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicIntegerDemo {

    public static void main(String[] args) {

        AtomicInteger atomicInteger = new AtomicInteger();
        System.out.println(atomicInteger);

        AtomicInteger atomicInteger1 = new AtomicInteger(3);
        System.out.println(atomicInteger1);

        System.out.println(atomicInteger.get());
        System.out.println(atomicInteger1.get());

        System.out.println(atomicInteger.getAndIncrement());
        System.out.println(atomicInteger.get());

        System.out.println(atomicInteger.incrementAndGet());

        System.out.println(atomicInteger.addAndGet(3));
        System.out.println(atomicInteger.getAndAdd(2));
        System.out.println(atomicInteger.get());

        System.out.println(atomicInteger.getAndSet(2));
        System.out.println(atomicInteger.get());

    }
}
